<?
	session_start();
	include("lib/config.php");
	include("lib/var.php");
	$show 		= $HTTP_GET_VARS['show'];
	$pengajuan 	= $HTTP_GET_VARS['pengajuan'];
	$level 		= $HTTP_GET_VARS['level'];
	$category 	= $HTTP_GET_VARS['category'];
	$group 		= $HTTP_GET_VARS['group'];
	$gc 		= $HTTP_GET_VARS['gc'];
//	session_register
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Aplikasi SDM - PT Surveyor Indonesia</title>
<script type="text/javascript">
	function logout()
	{
		var ok = confirm("Apakah Anda yakin KELUAR dari aplikasi ini ?");
		if(ok == true)
		{
			window.location.href="../lib/process.php?logout=yes";
			//href="lib/process.php?logout=yes"
		}
		else
		{
		}
	}

	function del_file(FILE)
	{
		var ok = confirm("Apakah Anda yakin menghapus file tersebut ?");
		if(ok == true)
		{
			window.location.href="<?=$PHP_SELF?>?hapus=yes&filenya="+FILE+"";
			//href="lib/process.php?logout=yes"
		}
		else
		{
		}
	}

	function show_popup2(page)
	{
		child = open
		(
			"../report/rep_cuti_opt.php",
			"",
			"scrollbars,width=600,height=200,left=150,top=150"
		);
	}
	
	function lap_med(page)
	{
		child = open
		(
			"../report/rep_med_opt.php?show=bank",
			"",
			"scrollbars,width=600,height=200,left=150,top=150"
		);
	}

	function lap_med2(page)
	{
		child = open
		(
			"../report/rep_med_opt.php?show=restitusi",
			"",
			"scrollbars,width=600,height=200,left=150,top=150"
		);
	}
	
	function pop_pel(page)
	{
		child = open
		(
			"../form/frm_cari_pelamar.php",
			"",
			"scrollbars,width=800,height=600,left=150,top=150"
		);
	}

	function pop_rek(page)
	{
		child = open
		(
			"../form/frm_rekruitmen.php",
			"",
			"scrollbars,width=600,height=200,left=150,top=150"
		);
	}

	function del_emp(NIK)
	{
		var ok = confirm("Apakah Anda yakin menghapus data pegawai \ndengan NIK "+NIK+" dari database kepegawaian ?");
		if(ok == true)
		{
			window.location.href="<?=$PHP_SELF?>?delete=yes&nik="+NIK+"&show=employee&divisi=<?=$_GET['divisi']?>&keyword=<?=$_GET['keyword']?>&st=<?=$_GET['st']?>&next=<?=$_GET['st']?>&page=<?=$_GET['page']?>";
		}
		else
		{
		}
	}
</script>
<link rel="stylesheet" type="text/css" href="<?=$path?>/style/style.css" />
<link rel="stylesheet" type="text/css" href="<?=$path?>/style/thickbox.css" />
<script type="text/javascript" src="<?=$path?>/js/menu_vertical.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$path?>/js/menu_bar.css">
<script language="javascript" src="<?=$path?>/js/event.js"></script>
<script language="javascript" src="<?=$path?>/js/calendar.js"></script>
<script language="javascript" src="<?=$path?>/js/jquery.min.js"></script>
<script language="javascript" src="<?=$path?>/js/apps.js"></script>
<script language="javascript" src="<?=$path?>/js/thickbox.js"></script>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
	<tr>
	 <td colspan="2" background="<?=$path?>/images/bgimg.jpg" align="left"><img src="<?=$path?>/images/img_01x.jpg">
     </td>
	</tr>
	<?
		if(trim($HTTP_SESSION_VARS['user_login']) == ""){
			echo"
			<tr>
			 <td align=center colspan=3>
			 <br><br><br>".$_SESSION['user_login']."
				Maaf, Anda tidak bisa mengakses halaman ini, Anda harus login terlebih dahulu ... <br><br>
				[ <a href='$path/index.php'>silahkan login</a> ]
			 </td>
			</tr>
			";
			exit();
		}
	?>
<?
// get hak akses
include("lib/config.php");
// administrasi user
$sadmu	= mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='administrasi_user'",$conn);
$radmu	= mssql_fetch_array($sadmu);
// cvonline
$scvoon = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='cvonline'",$conn);
$rcvoon = mssql_fetch_array($scvoon);
// report
$srep = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='report'",$conn);
$rrep = mssql_fetch_array($srep);
// parameter data
$spar = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='parameter_data'",$conn);
$rpar = mssql_fetch_array($spar);
// cek hak akses untuk cabang
$sad = mssql_query("SELECT nama_menu FROM VPrivUser A, VCabang B WHERE username='".$HTTP_SESSION_VARS['user_login']."' AND baca='1' AND A.nama_menu=B.Kode_Cabang",$conn);
while($rad = mssql_fetch_array($sad)){
// VARIABLE UNTUK CABANG
$VAreaCode[] = $rad[0];
}
// untuk menu master karyawan
// master karyawan
///*
$smstk = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu IN ('track_record','master_karyawan','karir_ptsi','sanksi','penugasan','penilaian','cuti','medical','setup_medical')",$conn);
/*
$smstk = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND (nama_menu ='master_karyawan'
 OR nama_menu ='karir_ptsi' OR nama_menu ='sanksi' OR nama_menu ='track_record' OR nama_menu ='penugasan' OR nama_menu ='penilaian' OR nama_menu = 'cuti' OR nama_menu ='medical' OR nama_menu = 'setup_medical') ",$conn);
*/
//$smstk = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND (nama_menu ='track_record') ",$conn);
$rmstk = mssql_fetch_array($smstk);

// laporan medical
$slapmed = mssql_query("SELECT * FROM VPrivUser WHERE username='".$_SESSION['user_login']."' AND nama_menu='medical' AND approval='1'",$conn);
$rlapmed = mssql_num_rows($slapmed);
?>
    <tr>
     <td valign="top" rowspan="5" style="width: 100px; background-image:url(<?=$path?>/images/img_02x.jpg); background-repeat:no-repeat;">
     <div align="right" style="position:relative; right:5px; color:brown; font-weight:bold;"><br />
     <?=date("d F Y")?>
     </div>
     <br /><br /><br />
     <div align="right" style="position:relative; right:-5px; top:15px;">
     <table cellpadding="2" border="0">
      <?
		//if($rmstk[baca] == 1 || $rmstk[edit] == 1 || $rmstk[hapus] == 1 || $rmstk[tambah] == 1){
		$cccv = mssql_fetch_row($smstk);
		if(mssql_num_rows($smstk) > 0){
//		if($cccv[0] > 0){
		?>
      <tr>
       <td align="right"><a href="#" class="GG" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'Master')"><span class=Cell>&nbsp; Master Data &nbsp;</span></a></td>
      </tr>
      <?
	  }
		if($rcvoon[baca] == 1 || $rcvoon[edit] == 1 || $rcvoon[hapus] == 1 || $rcvoon[tambah] == 1){
		?>
      <tr>
       <td align="right"><a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'CV')"><span class=Cell style="background-color:#003399; color:#FFFFFF;">&nbsp; CV Online &nbsp;</span></a></td>
      </tr>
        <?
        }
		if($rrep[baca] == 1 || $rrep[edit] == 1 || $rrep[hapus] == 1 || $rrep[tambah] == 1){		
		?>
      <tr>
       <td align="right"><a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'Report')"><span class=Cell>&nbsp; Laporan &nbsp;</span></a></td>
      </tr>
      <?
      }
		// hanya untuk laporan medical
	  if($rlapmed > 0){
	  ?>
 
      <tr>
       <td align="right"><a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'ReportMedical')"><span class=Cell>&nbsp; Laporan Medical&nbsp;</span></a></td>
      </tr>
		
		<?
		}
        if($rpar[baca] == 1 || $rpar[edit] == 1 || $rpar[hapus] == 1 || $rpar[tambah] == 1){
		?>
      <tr>
       <td align="right"><a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'PD')"><span class=Cell>&nbsp; Parameter Data &nbsp;</span></a></td>
      </tr> 
		<?
		}
	   if($radmu[baca] == 1 || $radmu[edit] == 1 || $radmu[hapus] == 1 || $radmu[tambah] == 1){
		?>
      <tr>
       <td align="right"><a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'AU')"><span class=Cell >&nbsp; Administrasi User &nbsp;</span></a></td>
      </tr>   
      <?
      	}
	  ?>   
	  <tr>
       <td align="right"><a href="../form/frm_upload_file.php"><span class=Cell>&nbsp; Download &nbsp;</a></span></td>
      </tr>
	  <tr>
       <td>&nbsp;</td>
      </tr>
	  <tr>
       <td>&nbsp;</td>
      </tr>
      <tr>
       <td align="right"><a href="../form/frm_ch_pass.php"><span class=Cell>&nbsp; Ubah Password &nbsp;</span></a></td>
      </tr>      
      <tr>
       <td align="right"><a href="#" onclick="logout();"><span class=Cell>&nbsp; Logout &nbsp;</span></a></td>
      </tr>      
     </table>
     </div>
     </td>
      <td style="border-bottom:solid 1px #CCCCCC; border-left: solid 1px #7badd3; width:879px;" valign="middle">
	  <table cellpadding="0" cellspacing="0" width="100%" border="0">
	   <tr>
	    <td width="40%"><img src="<?=$path?>/images/img_03x.jpg"/></td>
		<td width="60%" align="left" style="font-size:14px; color:#000066; font-weight:bold;">HUMAN RESOURCES INFORMATION SYSTEM </td>
	   </tr>
	  </table>
	  </td>
     </tr>
     <tr height="20">
      <td valign="top" style="border-bottom:solid 1px #7badd3; border-left: solid 1px #7badd3;">
       <table width="100%" cellpadding="0" cellspacing="0" border="0" height="20">
        <tr>
         <td width="50%" style="border-right:solid 1px #CCCCCC; text-indent:20px;">Anda Login sebagai <span style="color:blue; font-weight:bold;">
     <?
     // get nama
	 $sN	= mssql_query("SELECT NIK, Nama FROM Karyawan WHERE NIK='".$HTTP_SESSION_VARS['user_login']."'",$conn);
	 if(mssql_num_rows($sN) > 0){
	 	$rN = mssql_fetch_array($sN);
		echo"$rN[Nama]";
	 }
	 else{
	 	echo $_SESSION['user_login'];
	 }
	 ?>
         </span></td>
         <td width="50%" bgcolor="#F5f5f5" ><?
         switch($show){
		 	case "employee":
							$title = "MASTER KARYAWAN";
							break;
		 	case "karirptsi":
							$title = "KARIR DI PT SURVEYOR INDONESIA";
							break;
		 	case "sanksi":
							$title = "SANKSI";
							break;
		 	case "medical":
							$title = "MEDICAL PEGAWAI";
							break;
		 	case "setup_medical":
							$title = "PLAFON PENGOBATAN PEGAWAI";
							break;
		 	case "plafon_awal":
							$title = "ENTRY PLAFON PENGOBATAN PEGAWAI";
							break;
		 	case "rekening":
							$title = "DATA REKENING KARYAWAN";
							break;
		 	case "historical":
							$title = "DATA PENGAJUAN PENGOBATAN";
							break;
		 	case "data_umum":
							$title = "DATA UMUM PEGAWAI";
							break;
		 	case "status_karyawan":
							$title = "STATUS PEGAWAI";
							break;
		 	case "pendidikan":
							$title = "DATA PENDIDIKAN";
							break;
		 	case "list_karir":
							$title = "KARIR DI PT SURVEYOR INDONESIA";
							break;
		 	case "track_record":
							$title = "TRACK RECORD";
							break;
		 	case "penugasan":
							$title = "PENUGASAN";
							break;
		 	case "cuti_khusus":
							$title = "CUTI KHUSUS";
							break;
		 	case "cuti_tahunan":
							$title = "CUTI TAHUNAN";
							break;
		 	case "cuti_besar":
							$title = "CUTI BESAR";
							break;
		 	case "detail_cuti_besar":
							$title = "DETIL CUTI BESAR";
							break;
		 	case "cuti":
							$title = "CUTI PEGAWAI";
							break;
		 	case "log_book_cvonline":
							$title = "LOG BOOK CV ONLINE";
							break;
		 	case "par_lokasi":
							$title = "PARAMETER LOKASI (KOTA/PROPINSI)";
							break;
		 	case "tbl_unit_kerja":
							$title = "PARAMETER UNIT KERJA &raquo; DIREKTORAT";
							break;
		 	case "tbl_koor":
							$title = "PARAMETER UNIT KERJA &raquo; KOORDINATOR TEKNIS";
							break;
		 	case "tbl_cabang":
							$title = "PARAMETER UNIT KERJA &raquo; CABANG/BIRO/DIVISI";
							break;
		 	case "tbl_bagian":
							$title = "PARAMETER UNIT KERJA &raquo; BAGIAN";
							break;
		 	case "tbl_seksi":
							$title = "PARAMETER UNIT KERJA &raquo; SEKSI";
							break;
		 	case "par_lp2":
							$title = "PARAMETER UNSUR PENILAIAN (LP2)";
							break;
		 	case "cat_lp2":
							$title = "PARAMETER KATEGORI UNSUR PENILAIAN (LP2)";
							break;
		 	case "par_fungsional":
							$title = "PARAMETER FUNGSIONAL";
							break;
		 	case "par_jabatan":
							$title = "PARAMETER JABATAN";
							break;
		 	case "par_jns_cuti":
							$title = "PARAMETER JENIS CUTI";
							break;
		 	case "par_pendidikan":
							$title = "PARAMETER PENDIDIKAN";
							break;
		 	case "par_bank":
							$title = "PARAMETER BANK";
							break;
		 	case "par_setup":
							$title = "PARAMETER UMUM";
							break;
		 	case "list_par_setup":
							$title = "PARAMETER UMUM &raquo; ".strtoupper($group)."";
							break;
		 	case "pribadi":
							$title = "DATA PRIBADI";
							break;
		 	case "kecakapan":
							$title = "DATA KECAKAPAN";
							break;
		 	case "keluarga":
							$title = "DATA KELUARGA";
							break;
		 	case "karir":
							$title = "PENGALAMAN / KARIR";
							break;
		 	case "organisasi":
							$title = "ORGANISASI";
							break;
		 	case "dokumen":
							$title = "DOKUMEN PEGAWAI";
							break;
		 	case "list_nilai":
							$title = "DATA PENILAIAN";
							break;
		 	case "penilaian":
							$title = "DATA PENILAIAN PEGAWAI";
							break;
		 	case "list_cuti_tahunan":
							$title = "CUTI TAHUNAN";
							break;
		 	case "list_sanksi":
							$title = "DAFTAR SANKSI";
							break;
		 	case "list_track_record":
							$title = "DAFTAR TRACK RECORD";
							break;
		 	case "list_tugas":
							$title = "DAFTAR PENUGASAN";
							break;
		 	case "list_cuti_tahunan":
							$title = "CUTI TAHUNAN";
							break;
		 	case "cuti_tahunan_ed":
							$title = "CUTI TAHUNAN";
							break;
		 }
		 
         switch($pengajuan){
		 	case "yes":
							$title = "PENGAJUAN PENGOBATAN";
							break;
		 }
	
         switch($category){
		 	case "atasan":
							$title = "KATEGORI UNSUR PENILAIAN &raquo; ATASAN";
							break;
		 	case "pegawai":
							$title = "KATEGORI UNSUR PENILAIAN &raquo; PEGAWAI";
							break;
		 	case "peers":
							$title = "KATEGORI UNSUR PENILAIAN &raquo; PEERS/REKAN KERJA";
							break;
		 }
		 
         switch($level){
		 	case "1":
							$title = "PARAMETER UNIT KERJA &raquo; DIREKTORAT";
							break;
		 	case "2":
							$title = "PARAMETER UNIT KERJA &raquo; KOORDINATOR TEKNIS";
							break;
		 	case "3":
							$title = "PARAMETER UNIT KERJA &raquo; CABANG/BIRO/DIVISI";
							break;
		 	case "4":
							$title = "PARAMETER UNIT KERJA &raquo; BAGIAN";
							break;
		 	case "5":
							$title = "PARAMETER UNIT KERJA &raquo; SEKSI";
							break;
		 }
		 
		 ?>
         <span style="text-indent:15px; font-weight:bold;"><span style="color:red; font-weight:bold;">&raquo; </span><?=$title?></span></td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td align="left" valign="top"><div style="position:relative; left:20px; width:97%;" align="left">
